package com.pyxis.amidrinking;


import java.util.ArrayList;
import java.util.Iterator;

import com.pyxis.amidrinking.db.DBBehaverages;
import com.pyxis.amidrinking.entities.Behaverage;
import com.pyxis.amidrinking.helpers.BevAdapter;

import android.app.Activity;
import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

public class SpecificDrinkingScreen  extends Activity {

	private ArrayList<Behaverage> lstCurrBeh = new ArrayList<Behaverage>();
	private BevAdapter bevAdapter;
	
	@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        Bundle bundle = this.getIntent().getExtras();
		String category = bundle.getString("cat");
		this.setTitle(category);
		
		for (Behaverage beh : DBBehaverages.lstBehaverage) {
			if(beh.category.description.equals(category))
				lstCurrBeh.add(beh);
		}
		
		bevAdapter = new BevAdapter(this, R.layout.listview_item_row,lstCurrBeh);
		setContentView(R.layout.activity_spec_drink);
		ListView listView1 = (ListView)findViewById(R.id.listView1);
	         
	        View header = (View)getLayoutInflater().inflate(R.layout.listview_header_row, null);
	        listView1.addHeaderView(header);
	        
	        listView1.setAdapter(bevAdapter);
	        
	        listView1.setOnItemClickListener(new OnItemClickListener() {

				@Override
				public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
					BevAdapter ad = (BevAdapter) parent.getAdapter();
					Behaverage bevhare = ad.getItem(position);
					
				}
	        	
			});
	        
	}
}
